#ifndef COMMON_H
#define COMMON_H
#include<QPoint>
#include <qcolor.h>
#include <qmap.h>
#include <qrect.h>

//道路的构造函数
struct Road{
public:

    Road(const int &id,const QPoint &start,const QPoint &end):
        id(id),
        start(start),
        end(end)
    {
    }
      int id;
      QPoint start,end;

};

//红绿灯
struct SignalLamp{
public:
    int count;//倒计时
//    int r_duration;给一个总的持续时间
    QColor color;//信号灯的颜色
};
//路口
struct Cross{
    public:
    Cross(const int &id):id(id){}
    Road *N_exit,*N_entrance,
         *S_exit,*S_entrance,
         *E_exit,*E_entrance,
         *W_exit,*W_entrance;
    int id;
    QRect local;
    QList<SignalLamp *>list_sl;//保存路口的信号灯
    QMap<Road *,SignalLamp *>road_sl;//可以得到道路和信号灯的关系
};

//小车类

struct Car{
public:
    Car(const int &id, Road *road, float duration=0.0):
        id(id),
        road(road),
        duration(duration)
    {}
    int id;
    Road *road;
    float duration;//这条路走了多远

};

#endif // COMMON_H
